<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改页面</title>
    <link rel="stylesheet" href="/static/pengpai/component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">

            <input type="hidden" name="id" lay-verify="required" lay-reqtext="用户名不能为空" placeholder="请输入参数名" th:value="${webmessage.id}" READONLY class="layui-input">
            <div class="layui-form-item">
                <label class="layui-form-label">提问用户</label>
                <div class="layui-input-block">
                    <input type="text"  th:value="${webmessage.name}" lay-verify="title"
                           autocomplete="off" readonly placeholder="" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">用户邮箱</label>
                <div class="layui-input-block">
                    <input type="text"  th:value="${webmessage.email}" readonly lay-verify="title"
                           autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">用户手机</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${webmessage.phone}" lay-verify="title" readonly autocomplete="off"
                           placeholder="请输入标题" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">主题</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${webmessage.subject}" readonly lay-verify="title" autocomplete="off"
                           placeholder="请输入标题" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">提问内容</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${webmessage.message}" readonly lay-verify="title" autocomplete="off"
                           placeholder="请输入标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">提问时间</label>
                <div class="layui-input-block">
                    <input type="text" th:value="${webmessage.askDate}" readonly lay-verify="title" autocomplete="off"
                           placeholder="请输入标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">是否回复</label>
                <div class="layui-input-block">
                    <input type="radio" name="answer" value="1" title="是" th:checked="${webmessage.answer==1}">
                    <input type="radio" name="answer" value="0" title="否" th:checked="${webmessage.answer==0}">
                </div>
            </div>
            <div class="layui-form-item">
            <label class="layui-form-label">回答内容</label>
            <div class="layui-input-block">
                <input type="text" name="answerContent" th:value="${webmessage.answerContent}"  lay-verify="title" autocomplete="off"
                       placeholder="请输入标题" class="layui-input">
            </div>

        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="button" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="user-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="/static/pengpai/component/layui/layui.js"></script>
<script src="/static/pengpai/component/pear/pear.js"></script>
<script>
    layui.use(['form', 'jquery'], function() {
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(user-save)', function(data) {
            $.post("/webMessage/update",data.field,function(r){
                console.info(r.code);
                if(r.code === 200){
                    parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
                    parent.location.reload();
                }else{
                    layer.msg('提交失败！');
                }
            });
        });
    })
</script>
<script>
</script>
</body>
</html>
